package com.ruoyi.web.controller.HUAWEI;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;

import java.util.List;
import java.util.Arrays;

import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.HUAWEI.*;
import com.ruoyi.system.domain.function.ProdOrderDTO;
import com.ruoyi.system.service.IProdPlanService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.service.ITBtpMtlCurriculumViateTiService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

import javax.xml.soap.SOAPException;

/**
 * EMS厂履历数据Controller
 *
 * @author ruoyi
 * @date 2023-03-08
 */
@Api(tags = "EMS厂履历数据接口api")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/huawei/ti" )
public class TBtpMtlCurriculumViateTiController extends BaseController {
    private final ITBtpMtlCurriculumViateTiService iTBtpMtlCurriculumViateTiService;


    @PostMapping("/purchaseOrder")
    @ApiOperation(value = "采购订单同步WMS>MOM")
    public AjaxResult purchaseOrder(@RequestBody List<TBtpMtlCurriculumViateTiDTO> list) {
        return AjaxResult.success(iTBtpMtlCurriculumViateTiService.purchaseOrder(list));
    }

    @PostMapping("/retrieval")
    @ApiOperation(value = "成品出库信息上传至华为WMS>MOM")
    public AjaxResult retrieval(@RequestBody List<EmsBarcodeShipmentDTO> list) {
        return AjaxResult.success(iTBtpMtlCurriculumViateTiService.retrieval(list));
    }

    @PostMapping("/testHuaweiZsxx")
    @ApiOperation(value = "测试上传父子条码追溯信息MOM>HUAWEI")
    public AjaxResult testHuaweiZsxx(@RequestBody EmsBarcodeRelation emsBarcodeRelation) throws SOAPException {
        return AjaxResult.success(iTBtpMtlCurriculumViateTiService.testHuaweiZsxx(emsBarcodeRelation));
    }

    @PostMapping("/testHuaweiTmsx")
    @ApiOperation(value = "测试条码属性信息回传MOM>HUAWEI")
    public AjaxResult testHuaweiTmsx(@RequestBody EmsBarcodeAttribute bute)  {
        return AjaxResult.success(iTBtpMtlCurriculumViateTiService.testHuaweiTmsx(bute));
    }

    @GetMapping("/getEntityRevision")
    @ApiOperation(value = "测试根据任务令获取对应软件信息MOM>HUAWEI")
    public AjaxResult getEntityRevision(@RequestParam String po) {
        return iTBtpMtlCurriculumViateTiService.getEntityRevision(po);
    }

    @PostMapping("/testHuaweiGdkg")
    @ApiOperation(value = "测试工单开工信息回传MOM>HUAWEI")
    public AjaxResult testHuaweiGdkg(@RequestBody GdkgInfoDTO dto)  {
        return AjaxResult.success(iTBtpMtlCurriculumViateTiService.uploadKg(dto));
    }


}
